package com.taikang.hmp.frame.common;

import java.util.HashMap;
import java.util.Map;

/** 
 * 错误码
 * author:qrp
 */
public class ErrorConstant {
	
	/**
	 * 错误码映射MAP
	 */
	public static Map<String,String> ERRMAP = new HashMap<String,String>();
	
	
	//****************************************************************
	//session过期
	public static String SESSION_TIMEOUT              = "199001";
	//密码错误
	public static String HD_PASSWORD_ERR              = "199002";
	//未填写基本信息
	public static String HD_CUSTOMER_BASE_DATA_NULL   = "199003";
	//****************************************************************
	
	
	
	
	//通用错误
	public static String COMMON_ERR                   = "199999";
	
    
	//1打头的为公共错误
	public static String REQUEST_IS_NOT_HTTP          = "100001";
	public static String RESPONSE_IS_NOT_HTTP         = "100002";
	public static String REQUEST_PARAM_MORE           = "100003";
	public static String REQUEST_PARAM_SIZEOVER       = "100004";	
	public static String JSON_PARAM_IS_NULL           = "100005";
	public static String CHK_PARAM_IS_NULL            = "100006";
	public static String IT_IS_NOT_JSON               = "100007";
	public static String ILLEGAL_HEADER               = "100008";
	public static String ILLEGAL_PARAMETER            = "100009";
	public static String ILLEGAL_PARAMETER_JSONSTR    = "100010";
	public static String ILLEGAL_PARAMETER_CHECKSTR   = "100011";
	public static String JSONSTR_METHOD_IS_NULL       = "100012";
	public static String JSONSTR_REQSOURCE_IS_NULL    = "100013";
	public static String JSONSTR_VERSION_IS_NULL      = "100014";
	public static String ILLEGAL_REQID                = "100015";
	public static String ILLEGAL_REQSOURCE            = "100016";
	public static String ILLEGAL_REQVERSION           = "100017";
	public static String ILLEGAL_METHOD               = "100018";
	public static String ILLEGAL_SESSIONID            = "100019";
	public static String ILLEGAL_UID                  = "100020";
	public static String BIZ_VALIDATE_FAIL            = "100021";
	public static String ACTION_METHOD_NOT_REGIST     = "100022";
	public static String CHECKSTR_NOT_MAPPING         = "100023";
	//session
	public static String SESSION_NOT_MATCH_UID        = "100030";
	public static String SESSIONID_MUST_NOT_BE_NULL   = "100031";
	public static String UID_MUST_NOT_BE_NULL         = "100032";
	public static String UID_NOT_LOGIN                = "100033";
	//sms
	public static String SEND_SMS_FREQUENTLY          = "100034";
	
	//2打头的为高糖管家错误
	public static String HD_USER_NOT_EXIST            = "200001";
	public static String HD_MOBILE_IS_NULL            = "200002";
	public static String HD_MOBILE_IS_EXISTS          = "200003";
	public static String HD_MOBILE_IS_NOT_EXISTS      = "200004";
	public static String HD_REGIST_OCUPATION          = "200005";
	public static String HD_REGIST_EXIST              = "200006";
	public static String HD_IN_BLACKLIST              = "200007";
	public static String HD_NO_PERSONAL_INFO          = "200008";
	public static String DATAMIN_FORMAT_ERROR         = "200009";
	public static String HD_IDENTIFYCODE_NOT_EXIST    = "200010";
	public static String HD_IDNO_IS_EXISTS            = "200017";
	
	public static String HD_SAVE_FAIL                 = "200011";
	public static String HD_DELETE_FAIL               = "200012";
	public static String HD_UPDATE_FAIL               = "200018";
	public static String ADD_FRIEND_FAIL              = "200013";
	public static String SAME_USER                    = "200014";
	public static String IS_FRIEND                    = "200015";
	public static String HD_NO_TOKEN            = "200016";
	
	
	//3打头的为泰康医生
	public static String HD_ACTIVATIONCODE_NOT_EXIST  = "300001";
	public static String USER_NOT_COLLECTION          = "300002";
	public static String HD_PASSWORD_OLDERR           = "300003";
	public static String HD_MESSAGE_EXIST             = "300004";
	public static String HD_GET_PM_FAIL               = "300005";
	public static String HD_INVITATION_NO_EXIST       = "300006";
	public static String HD_ACTIVATIONCODE_IS_USED    = "300007";
	public static String HD_UCM_FAIL                  = "300008";
	public static String ICON_FAIL                    = "300009";
	public static String HD_ACTIVATIONCODE_USE_EXIST  = "300010";
	public static String HD_NOT_WORK                  = "300011";
	public static String HD_NOT_TEST                  = "300012";
	public static String HD_NOT_VERSION               = "300013";
	//8打头的为参数安全校验错误
	public static String SECRITY_PARAM_SQL            = "800001";
	public static String SECRITY_PARAM_ALERT          = "800002";
	public static String SECRITY_PARAM_LOCATION       = "800003";
	public static String SECRITY_PARAM_STYLE          = "800004";
	public static String SECRITY_PARAM_COOKIE         = "800005";
	public static String SECRITY_PARAM_EVAL           = "800006";
	public static String SECRITY_PARAM_ESCAPE         = "800007";
	public static String SECRITY_PARAM_EXEC           = "800008";
	public static String SECRITY_PARAM_MSGBOX         = "800009";
	public static String SECRITY_PARAM_CONFIRM        = "800010";
	public static String SECRITY_PARAM_PROMPT         = "800011";
	public static String SECRITY_PARAM_SCRIPT         = "800012";
	public static String SECRITY_PARAM_VALUE	      = "800013";
	
	static{
		//
		ERRMAP.put(HD_CUSTOMER_BASE_DATA_NULL      , "客户基本信息未获知");
		ERRMAP.put(SESSION_TIMEOUT                 , "session过期");
		ERRMAP.put(HD_PASSWORD_ERR                 , "用户名或密码错误");
		//
		ERRMAP.put(COMMON_ERR                      , "通用错误");
		//
		ERRMAP.put(REQUEST_IS_NOT_HTTP             , "Can only process HttpServletRequest");
		ERRMAP.put(RESPONSE_IS_NOT_HTTP            , "Can only process HttpServletResponse");
		ERRMAP.put(REQUEST_PARAM_MORE              , "ServletRequest parameter more then rule");
		ERRMAP.put(REQUEST_PARAM_SIZEOVER          , "ServletRequest parameter size oversize");
		ERRMAP.put(JSON_PARAM_IS_NULL              , "jsonStr参数为空");
		ERRMAP.put(CHK_PARAM_IS_NULL               , "checkStr参数为空");
		ERRMAP.put(IT_IS_NOT_JSON                  , "返回值不是json");
		ERRMAP.put(ILLEGAL_HEADER                  , "request header contains illegal values");
		ERRMAP.put(ILLEGAL_PARAMETER               , "request param contains illegal values");
		ERRMAP.put(ILLEGAL_PARAMETER_JSONSTR       , "request param jsonStr is not original");
		ERRMAP.put(JSONSTR_METHOD_IS_NULL          , "jsonStr param method is null");
		ERRMAP.put(JSONSTR_REQSOURCE_IS_NULL       , "jsonStr param requestsource is null");
		ERRMAP.put(JSONSTR_VERSION_IS_NULL         , "jsonStr param version is null");
		ERRMAP.put(ILLEGAL_REQID                   , "requestid is null and or extend 32");
		ERRMAP.put(ILLEGAL_REQSOURCE               , "无效的requestsource");
		ERRMAP.put(ILLEGAL_REQVERSION              , "无效的version");
		ERRMAP.put(ILLEGAL_METHOD                  , "无效的method");
		ERRMAP.put(ILLEGAL_SESSIONID               , "无效的sessionid");
		ERRMAP.put(ILLEGAL_UID                     , "无效的uid");
		ERRMAP.put(BIZ_VALIDATE_FAIL               , "验证失败");
		ERRMAP.put(ACTION_METHOD_NOT_REGIST        , "服务未注册");
		ERRMAP.put(CHECKSTR_NOT_MAPPING            , "jsonStr and  checkStr are mismatched");
		//session
		ERRMAP.put(SESSION_NOT_MATCH_UID           , "session与请求uid不匹配");
		ERRMAP.put(SESSIONID_MUST_NOT_BE_NULL      , "sessionid不能为空");
		ERRMAP.put(UID_MUST_NOT_BE_NULL            , "uid不能为空");
		ERRMAP.put(UID_NOT_LOGIN                   , "user未登陆");
//		ERRMAP.put(HD_NO_ACTIVECODE            	   , "用户没有激活");
		//
		ERRMAP.put(HD_IDENTIFYCODE_NOT_EXIST	   , "验证码错误");
		ERRMAP.put(SEND_SMS_FREQUENTLY             , "短信发送过于频繁");
		ERRMAP.put(HD_USER_NOT_EXIST               , "用户不存在");
		ERRMAP.put(HD_MOBILE_IS_NULL               , "该手机号码未注册");
		ERRMAP.put(HD_MOBILE_IS_EXISTS             , "手机号码存在");
		ERRMAP.put(HD_MOBILE_IS_NOT_EXISTS         , "手机号码不存在，请重新输入");
		ERRMAP.put(HD_REGIST_OCUPATION             , "用户名已经被占用，请重新输入");
		ERRMAP.put(HD_REGIST_EXIST                 , "用户已存在");
		ERRMAP.put(HD_IDNO_IS_EXISTS                 , "身份证已注册，请重新输入");
		ERRMAP.put(HD_IN_BLACKLIST                 , "用户已被加入黑名单");
		ERRMAP.put(HD_NO_PERSONAL_INFO             , "未保存用户基本信息");
		ERRMAP.put(DATAMIN_FORMAT_ERROR            , "有效的日期时间格式为yyyy-MM-dd HH:mm");
		ERRMAP.put(HD_NO_TOKEN               , "未获得授权");
		
		//
		ERRMAP.put(HD_SAVE_FAIL                    , "保存失败");
		ERRMAP.put(HD_DELETE_FAIL                  , "保存知识库失败");
		ERRMAP.put(HD_UPDATE_FAIL                  , "更新知识库失败");
		ERRMAP.put(ADD_FRIEND_FAIL                  , "您所查找的用户不存在,请重新输入");
		ERRMAP.put(SAME_USER                        , "不能给自己发送消息");
		ERRMAP.put(IS_FRIEND                        , "不能重复添加 好友");
		
		//泰康医生
		ERRMAP.put(HD_ACTIVATIONCODE_NOT_EXIST	   , "此激活码不存在");
		ERRMAP.put(HD_ACTIVATIONCODE_USE_EXIST	   , "此激活码已使用");
		ERRMAP.put(USER_NOT_COLLECTION	   ,     "用户没有收藏资讯");
		ERRMAP.put(HD_PASSWORD_OLDERR	   ,     "原始密码错误");
		ERRMAP.put(HD_MESSAGE_EXIST	   ,      "该条资讯已经收藏过");
		ERRMAP.put(HD_GET_PM_FAIL      ,      "获取pm2.5信息失败");
		ERRMAP.put(HD_INVITATION_NO_EXIST      , "此邀请码不存在");
		ERRMAP.put(HD_ACTIVATIONCODE_IS_USED      , "此激活码已使用");
		ERRMAP.put(HD_UCM_FAIL                      , "HD_UCM_FAIL");
		ERRMAP.put(ICON_FAIL                      , "头像保存失败");
		ERRMAP.put(HD_NOT_WORK                      , "离职人员");
		ERRMAP.put(HD_NOT_VERSION                      , "没有对应的版本");
		ERRMAP.put(HD_NOT_TEST                      , "没有进行中医体质测评");
		
		//
		ERRMAP.put(SECRITY_PARAM_SQL               , "SQL校验不通过");
		ERRMAP.put(SECRITY_PARAM_ALERT             , "ALERT校验不通过");
		ERRMAP.put(SECRITY_PARAM_LOCATION          , "LOCATION校验不通过");
		ERRMAP.put(SECRITY_PARAM_STYLE             , "STYLE校验不通过");
		ERRMAP.put(SECRITY_PARAM_COOKIE            , "COOKIE校验不通过");
		ERRMAP.put(SECRITY_PARAM_EVAL              , "EVAL校验不通过");
		ERRMAP.put(SECRITY_PARAM_ESCAPE            , "ESCAPE校验不通过");
		ERRMAP.put(SECRITY_PARAM_EXEC              , "EXEC校验不通过");
		ERRMAP.put(SECRITY_PARAM_MSGBOX            , "MSGBOX校验不通过");
		ERRMAP.put(SECRITY_PARAM_CONFIRM           , "CONFIRM校验不通过");
		ERRMAP.put(SECRITY_PARAM_PROMPT            , "PROMPT校验不通过");
		ERRMAP.put(SECRITY_PARAM_SCRIPT            , "SCRIPT校验不通过");
		ERRMAP.put(HD_UCM_FAIL                     , "UCM FAIL");
		
		
	}
	
	public static String getErrMsg(String errCode){
		if(errCode== null){
			return "";
		}
		if(ERRMAP.containsKey(errCode)){
			return ERRMAP.get(errCode);
		}
		return "";
	}

}
